package ng.map;

import java.awt.Graphics2D;
import java.io.IOException;

import ng.graphics.Animation;
import ng.graphics.FrameBuffer;
import ng.lib.Vector2D;

public class Rocket extends MapObjectDynamic {
	private static FrameBuffer frames;
	static {
		try {
			String[] p = new String[5];
			for(int i = 0;i < p.length; i++){
				p[i] = "data/textures/projectiles/rocket/00"+(i+1)+".png";
			}
			frames = new FrameBuffer(p);
		} catch (IOException e) {
			System.err.println("An image isn't at the right place");
			e.printStackTrace();
		}
	}

	public Rocket(Vector2D p) {
		super();
		this.animation = new Animation(frames, 1);
		this.position = p;
		this.mass = 1;
		
	
	}
	
	@Override
	public void tick() {
		super.tick();	
		this.setAngle(Math.atan(this.speed.x/this.speed.y));
		this.angle += Math.PI/2;
		
	}

	@Override
	public void paintComponent(Graphics2D g2) {
		super.paintComponent(g2);
	}

}
